<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

	<% String [] selTopics = (String[]) request.getSession().getAttribute("selTopics"); %>
	
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Select tags</title>
		<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
	</head>
	
	<body>
	<div id="wrapper">
	
		<%@ include file="headerNews.jsp" %>
		
		<%@ include file="menuNews.jsp" %>
		
		<div id="page">
		<div id="page-bgtop">
		<div id="page-bgbtm">
		
		<div id="content">
	
		<div>
			<h1 class="mainText">Select the tags you want to subscribe to in the selected topics in the selected newspapers</h1>
		</div>
		<div>
			<h2 class="mainText"> You will only receive messages with all the tags you select</h2>
		</div>

		<div>
			<form action="subscribe" method="post">
				<c:forEach var="topic" items="${selTopics}">
					<c:choose>
						<c:when test="${not empty tagClouder.propertiesCloud[topic]}">
							<div><h3>${topic}</h3></div>
							<div><input type="hidden" name="selTopics" value="${topic}" /></div>
							<div>
								<c:forEach var="tagName" items="${tagClouder.propertiesCloud[topic]}">
									<div>
									<h4>${tagName.key}</h4>
									</div>
									<c:forEach var="tagValue" items="${tagName.value}">
										<div>
											<input type="checkbox" name="selTags${topic}" value="${tagName.key} = '${tagValue.key}'" /> ${tagValue.key} (${tagValue.value})
										</div>
									</c:forEach>
								</c:forEach>
							</div>
						</c:when>
						<c:otherwise>
							<div><input type="hidden" name="selTopics" value="${topic}" /></div>
						</c:otherwise>
					</c:choose>
				</c:forEach>
				
				<div>
                	<input type="submit" class="bigButton" name="submitTags" value="Send selection" />
                </div>
			</form>
		</div>
		
		<div style="clear: both;">&nbsp;</div>
		
		</div>
		
		<%@ include file="sidebarNews.jsp" %>
		<div style="clear: both;">&nbsp;</div>
		
		</div>
		</div>
		</div>
		
		<%@ include file="footerNews.jsp" %>

	</div>
	</body>
	
</html>